package com.ruoyi.project.pm.info.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.pm.common.domain.PMInfoVO;
import com.ruoyi.project.pm.info.domain.PMInfo;
import com.ruoyi.project.pm.info.domain.SalesCustomer;
import com.ruoyi.project.pm.info.service.IPMInfoService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.beans.MethodDescriptor;
import java.util.List;

/**
 * @author 铁蛋儿
 * @date 2020-09-18 11:24
 * @desc 百战程序员 http://www.itbaizhan.com
 * <p>
 * 项目信息查看 controller层
 * <p>
 * 继承BaseController
 */
@Controller
@RequestMapping("/pm/info")
public class PMInfoController extends BaseController {

    //注入service层的对象
    @Autowired
    private IPMInfoService pmInfoService;

    //前缀字符串 用于跳转
    private String prefix = "/pm/info";

    /**
     * 用于跳转到项目信息查看的前端页面
     *
     * @return 返回到templates/pm/info/info.html页面
     */
    @RequiresPermissions("pm:info:view")//校验当前用户的权限
    @GetMapping()
    public String info() {
        //返回 跳转到info.html页面
        return prefix + "/info";
    }

    /**
     * 分页查询
     *
     * @param pmInfo
     * @return
     */
    @RequiresPermissions("pm:info:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PMInfo pmInfo) {
        //调用分页的方法 设置分页
        startPage();
        //查询数据
        List<PMInfo> list = pmInfoService.selectPMInfoList(pmInfo);
        //返回 响应请求分页数据
        return getDataTable(list);
    }

}
